package com.jason.dubbo.service;

import com.jason.api.EmailService;
import com.jason.api.vo.Response;
import com.jason.constant.ResponseConstant;
import com.jason.mail.MailSender;
import com.jason.mail.MailSenderInfo;
import org.apache.dubbo.config.annotation.Service;

@Service
public class EmailServiceImpl implements EmailService {

    @Override
    public Response sendEmail(String email, String subject, String content) {
        String[] targets = {email};
        MailSenderInfo mailSenderInfo = new MailSenderInfo(targets, subject, content, null);
        boolean b = MailSender.sendMail(mailSenderInfo);
        System.out.println(email + "邮件发送成功:" + b);
        return new Response(ResponseConstant.SUCCESS);
    }
}
